(function () {
  // 步骤3：创建echarts实例
  let myChart = echarts.init(document.querySelector(".box9"));
  console.log(myChart);

  // 步骤4：定义配置（指定图表的配置项和数据）

  let option = {
    color: ["green", "blue", "indigo", "purple"],
    series: [
      {
        name: "访问来源",
        type: "pie",
        radius: ["50%", "70%"],
        avoidLabelOverlap: false,

        label: {
          normal: {
            show: true,
            position: "center",

            formatter: ["20%"].join("\n"),
            rich: {
              a: {
                color: "#fff",
                fontSize: 38,
                lineHeight: 30,
              },
              b: {
                color: "yellow",
                fontSize: 30,
                foneWeight: "bold",
                textShadowBlur: 20,
                textShadowColor: "yellow",
              },
            },
          },
        },
        labelLine: {
          normal: {
            show: false,
          },
        },
        data: [
          { value: 335, name: "直接访问", color: "#cccccc" },
          { value: 130, name: "邮件营销" },
        ],
      },
      {
        name: "边框1",
        type: "pie",
        hoverAnimation: false,
        radius: ["75%", "90%"],

        labelLine: {
          normal: {
            show: false,
          },
        },
        itemStyle: {
          normal: {
            borderWidth: 1,
            borderColor: "#ffffff",
            opacity: 0,
          },
        },
        data: [
          {
            value: 100,
            tooltip: {
              show: false,
            },
          },
        ],
      },
    ],
  };

  // 步骤5：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  //   window.onresize = function () {
  //     myChart.resize();
  //   };
})();
